<template>
  <common-manage
    :cp="'student'"
    :tableData="tableData"
    :table="table"
    :formTemplate="formTemplate"
    :fileUrl="'http://192.168.1.125:14000/webhdfs/v1/file/20230609083928/sample-student.xlsx?op=OPEN&user.name=root'"
    :uploadUrl="`http://192.168.1.125:8080/home/home/analysis/students`"
  ></common-manage>
</template>

<script>
import CommonManage from "@/components/CommonManage.vue";
import { getStudent } from "@/services/admin/student";
export default {
  components: { CommonManage },
  data() {
    return {
      tableData: [],
      table: [
        {
          label: "学号",
          prop: "student_id",
        },
        {
          label: "姓名",
          prop: "name",
        },
        {
          label: "密码",
          prop: "password",
        },
        {
          label: "性别",
          prop: "gender",
        },
        {
          label: "期班",
          prop: "period_class",
        },
      ],
      formTemplate: [
        {
          type: "input",
          label: "账号",
          key: "student_id",
          placeholder: "如果非导入用户建议使用手机号",
        },
        {
          type: "input",
          label: "姓名",
          key: "name",
        },
        {
          type: "input",
          label: "密码",
          key: "password",
        },
        {
          type: "select",
          label: "性别",
          key: "gender",
          opts: [
            {
              label: "男",
              value: "男",
            },
            {
              label: "女",
              value: "女",
            },
          ],
        },
        {
          type: "select",
          label: "期班",
          key: "period_class",
          opts: [
            {
              label: "默认期班",
              value: "默认期班",
            },
          ],
        },
      ],
    };
  },
  methods: {
    setTableData(tableData) {
      this.tableData = tableData;
    },
  },
  created() {
    // 获取教员数据
    getStudent().then((res) => {
      this.tableData = res.data.data.students || [];
    });
  },
};
</script>

<style>
</style>